package com.vatsalya.bakthi.yoga;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.vatsalya.bakthi.yoga.R;

public class MantrasListActivity extends Activity {
	 	@Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.mantraslist);
	        ListView listView1 = (ListView) findViewById(R.id.mantrasListView);
	        
	        String[] items = { "Ganapathy", "Om Namashivaya", "Gayatri Mantra", "Hare Rama Hare Krishna" };
	        
	        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
	                    android.R.layout.simple_list_item_1, items);
	        
	        listView1.setAdapter(adapter);
	        
	        
	        listView1.setOnItemClickListener(new OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                     Intent intent = new Intent(MantrasListActivity.this, MantraPlayerActivity.class);
                     intent.putExtra("fileName", getFileName(position));
                     startActivity(intent);
                }
	        });
	    }
	 	
		private String getFileName(int position){
			String fileName = null;
			switch (position) {
			  case 0: 
				fileName =  "Ganapathy.mp3";
				return fileName;
			  case 1: 
				fileName = "OmNamasivayaa.m4v";
				return fileName;
			  case 2: 
					fileName = "gayatri_mantra.mp3";
					return fileName;
			  case 3: 
					fileName = "hare_krishna.mp3";
					return fileName;
				 	  
			}
			return "";
		}
}
